<?php

namespace Modules\Admin\Http\Controllers\Renovations;

use Illuminate\Support\Facades\DB;
use Illuminate\Support\Str;
use Modules\Common\General\Security\Api\Gateway;
use Modules\Common\Models\AdminLog;
use Modules\Common\Models\Renovations;
use Modules\Common\Util\Api;
use Modules\Common\Util\Database;


class Update
{

     /**
     * @Route(path=/api/admin/renovation  method=put)
     */
    public function index()
    {
        Api::validate(['id' => 'required|integer']);
        $id = request('id');
        $adminUserIdDefault = auth('api')->user()->id;
        $eidDefault = auth('api')->user()->eid; 
        $sidDefault = auth('api')->user()->sid;
        Renovations::updateFromArray([
            'id' => $id,
            'status' => request('status'),
            'page_name' => request('page_name'),
            'search_json' => request('search_json'),
            'banner_json' => request('banner_json'),
            'recommend_json' => request('recommend_json'),
            'paid_content_json' => request('paid_content_json'),
            'style_json' => request('style_json'),
            'admin_user_id'=>$adminUserIdDefault,
            'eid'=>$eidDefault,
            'sid'=>$sidDefault,
            'type'=> request('type')
        ]);
        return Api::success();
    }
}